package com.lixin.smartclassroom.ui.home.tab2.activity

import com.lixin.smartclassroom.R
import com.lixin.smartclassroom.bean.DataListBean
import com.lixin.smartclassroom.databinding.ActivityCommitResultBinding
import com.lixin.smartclassroom.ui.home.adapter.answer
import com.lixin.smartclassroom.ui.home.tab1.activity.CourseDetailAct
import com.lixinkeji.base.BaseActivity
import com.lixinkeji.extension.getIntentString
import com.lixinkeji.extension.onClick
import com.lixinkeji.extension.start

/**
 * Description 提交结果
 * Author: lwc
 * Date:2023/12/13 15:32
 */
class PracticeResultAct : BaseActivity<ActivityCommitResultBinding>() {
    override fun getViewBinding() = ActivityCommitResultBinding.inflate(layoutInflater)

    override fun topBarHide() = true
    override fun startPadding() = false
    private lateinit var listBean: ArrayList<DataListBean>
    private var taskType = ""
    private var sendType = ""


    override fun iniView() {
        taskType = getIntentString("type")
        sendType = getIntentString("sendType")
        binding.apply {

            recyclerAnswer.answer().apply {
                R.id.tvQuestionNo.onClick {
                    context.start(LookAnswerAct::class.java) {
                        putExtra("questionType", (models?.get(modelPosition) as DataListBean).questionType)
                    }
                }
            }.models = getData()
        }

    }

    private fun getData(): ArrayList<DataListBean> {
        listBean = ArrayList<DataListBean>()
        listBean.add(DataListBean(sendType = sendType))
        listBean.add(DataListBean(sendType = sendType))
        listBean.add(DataListBean(sendType = sendType))
        listBean.add(DataListBean(sendType = sendType))
        return listBean
    }

    override fun onClick() {
        binding.apply {
            btnReturnCourse.onClick {
                start(SmartCourseDetailAct::class.java)
            }

            btnLookAnswer.onClick {
                start(LookAnswerAct::class.java)
            }
        }
    }

}